package com.zhyt.intelligentpipeline.exception;

import lombok.*;
import org.springframework.http.HttpStatus;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CustomException  extends RuntimeException{

    private HttpStatus httpStatus;

    private ErrorBody errorBody;


    public static CustomException of(HttpStatus httpStatus) {
        return CustomException.builder().httpStatus(httpStatus).build();
    }

    public static CustomException of(HttpStatus httpStatus, ErrorBody errorCode) {
        return CustomException.builder()
                .httpStatus(httpStatus)
                .errorBody(errorCode)
                .build();
    }

}
